import 'package:ruitmentapp/core/services/http_request.dart';
import 'package:flutter/material.dart';
import '../model/zj_homeposition_model.dart';
import 'package:ruitmentapp/core/services/http_request_model.dart';
import 'package:ruitmentapp/personnel/zj_tabbar_two_page.dart';
import 'package:ruitmentapp/personnel/model/zj_homeposition_model.dart';

class ZJMealRequest {
  static Future<Map> getMealData() async {
    // 1.发送网络请求
    const url = "/client/common/getExpectedPosition";
    final result = await HttpRequest.request(url);
    // print("===result===$result==${result.length}");

    // 2.json转modal
    List<Widget> meals = [];
    List<ACETabBarTwoButtonPage> models = [];

    for (var json in result) {
      ZJHomePositionModel model = ZJHomePositionModel.fromJson(json);
      // print("===position===${model.position}");
      meals.add(Tab(text: model.position));
      models.add(ACETabBarTwoButtonPage(model.positionId));
    }

    Map map = {
      'meals':meals,
      'models':models
    };
    // print("===result===$result==${result.length}");
    // print("===ok===$meals");
    return map;
  }
}